<template>
  <div>
    <van-datetime-picker
      v-model="currentDate"
      type="date"
      title="选择年月日"
      :min-date="minDate"
      :max-date="maxDate"
      @cancel="$emit('close')"
      @confirm="onconfirm"
    />
  </div>
</template>

<script>
import dayjs from 'dayjs'
export default {
  name: 'UpdateBirthday',
  components: {},
  props: ['value'],
  data() {
    return {
      minDate: new Date(1970, 1, 1),
      maxDate: new Date(),
      currentDate: new Date(this.value)
    }
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() { },
  methods: {
    onconfirm() {
      this.$emit('confirm', dayjs(this.currentDate).format('YYYY-MM-DD'))
      this.$emit('close')
    }
  }
}
</script>

<style scoped lang="less"></style>
